<script>
	import Header from "@/components/Header.vue"
	export default {
		components: {
			Header
		},
		data() {
			return {
				title: "详细信息",
				id:0,
				ziyuan_find:{},
				find:{}
			}
		},
		onLoad(options) {
			if(options.find){
				this.find = JSON.parse(options.find)
			}
			this.id=options.id
			this.get_ziyuan();
		},
		onShow() {
			this.get_ziyuan();
		},
		methods: {
			deleteItem() {
				var that = this
				
				uni.showModal({
					title: "确认删除",
					content: "删除后不可恢复",
					success: (e) => {
						if (e.confirm) {
							uni.request({
								url:getApp().globalData.host+'/api/Resource/delMyResource',
								data: {
									resource_id: that.id
								},
								header: {
									memberid:uni.getStorageSync('member_id'),
									membertoken:uni.getStorageSync('member_token'),
								},
								success:(r) => {
									uni.showToast({
										title: '删除成功',
										icon: 'none',
										duration: 2000,
										success() {
											uni.navigateBack({
											          delta: 1,
											        })
										}
									})
								},
							})
						}
					}
				})
			},
			get_ziyuan(){
				var that = this
				uni.request({
					url:getApp().globalData.host+'/api/Resource/getResourceInfo',
					data: {
						resource_id: that.id
					},
					header: {
						memberid:uni.getStorageSync('member_id'),
						membertoken:uni.getStorageSync('member_token'),
					},
					success:(r) => {
						that.ziyuan_find = r.data.data
						console.log(that.ziyuan_find)
					},
				})
			},
		}
	}
</script>
<template>
	<view class="p-30 custom-bg">
		<Header :title="title" />

		<!-- ======================需求相关 start ====================== -->

		<div class="p-25 bg-white rounded-30  mb-18">
			<div class="text-purple fz28 mb-18">
				-基本信息-
			</div>

			<div class="fz28 text-gray-16" v-for="(item,index) in ziyuan_find.jb_resource_info">
				<div class="mb-10">{{item}}</div>
			</div> 
		</div>

		<div class="p-25 bg-white rounded-30  mb-18">
			<!-- 除了其他 用这个标题 -->
			<div class="text-blue fz28 mb-18">
				-更多信息-
			</div>

			<div class="fz28 text-gray-16" v-for="(item,index) in ziyuan_find.gd_resource_info">
								<div class="mb-20">{{item}}</div>
							</div> 
		</div>
		<!-- ====================== 需求相关 end ====================== -->

		<div class="submit  text-white p-30 bg-white between px-50">
			<div class="text-purple center h-90 rounded-50  w-245 custom-input" @click="go('/pages/my/resources/form?item='+JSON.stringify(find))">
				编辑
			</div>
			<div class="bg-purple center h-90 rounded-50  w-245" @click="deleteItem">
				删除
			</div>
		</div>

		<div style="height: 300rpx;"></div>

	</view>
</template>



<style>
	.submit {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
	}

	page {
		background-color: #F8F8F8;
	}
</style>